/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package kyakya;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author hartono
 */
public class Util {

    public static String DateToMySQLDate(Date date){
        SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");        
        return sdf.format(date);
    }
    
    public static Date DateToDate(String date) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        try {
            return sdf.parse(date);
        } catch (ParseException ex) {
//            Logger.getLogger(Util.class.getName()).log(Level.SEVERE, null, ex);
            return new Date(0);
        }
    }
    
    
}

